sign: Support generic "spki" type of commit signatures
authorDaiki Ueno <dueno@redhat.com>
Fri, 12 Jul 2024 03:54:13 +0000 (12:54 +0900)
committerDaiki Ueno <dueno@redhat.com>
Tue, 18 Mar 2025 07:22:16 +0000 (16:22 +0900)
commit79470298bf2e5603b652a8fca8bf8a9669bf26b3
tree81544741e26ecd26340c3f8fbb121b8a5daedf81
parent86a7a53d86d6e6e953108d0bdfa162da4d7f282e
sign: Support generic "spki" type of commit signatures

The current "ed25519" signing type assumes raw Ed25519 key format for
both public and private keys. This patch generalizes it by adding a
new signature type "spki" which uses the X.509 SubjectPublicKeyInfo
format for public keys. Keys in this format can easily be created with
openssl tools and provide crypto agility[1] as the format embeds
algorithm identifier.

The supposed use-case of this feature is to attach multiple signatures
with different algorithms to a single commit, so even if an algorithm
turned vulnerable, the signatures made with other algorithms can still
be used as a fallback. For instance, signer can create an Ed25519
signature along with a quantum-resistent ML-DSA signature.

The following are a couple of implementation notes:

- The private keys shall be stored in the PKCS#8 format, though future
  extensions may support other format such as opaque key handles on a
  hardware token.

- The "spki" signature type prefers the keys to be encoded in the PEM
  format on disk, while it still accepts base64 encoded keys when given
  through the command-line.

1. https://en.wikipedia.org/wiki/Cryptographic_agility

Signed-off-by: Daiki Ueno <dueno@redhat.com>
18 files changed:
Makefile-libostree.am
Makefile-otcore.am
Makefile-tests.am
configure.ac
man/ostree-commit.xml
man/ostree-sign.xml
rust-bindings/sys/tests/constant.c
src/libostree/ostree-sign-spki.c [new file with mode: 0644]
src/libostree/ostree-sign-spki.h [new file with mode: 0644]
src/libostree/ostree-sign.c
src/libostree/ostree-sign.h
src/libotcore/otcore-spki-verify.c [new file with mode: 0644]
src/libotcore/otcore.h
tests/libtest.sh
tests/test-signed-commit-dummy.sh [new file with mode: 0755]
tests/test-signed-commit-ed25519.sh [new file with mode: 0755]
tests/test-signed-commit-spki.sh [new file with mode: 0755]
tests/test-signed-commit.sh [deleted file]